← Back to issue list

__init__ needs to be leaner and meaner

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1733584
Type
issue
State
open
Author
~sergiusens
Labels
Created
2017-11-21 12:42:42.248051+00:00
Updated
2017-11-21 20:17:04.313984+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

snapcraft/tests/unit/plugins/python/_basesuite.py:21: error: Name 'snapcraft.tests.unit.TestCase' is not defined snapcraft/tests/unit/plugins/test_jhbuild.py:21: error: Name 'snapcraft.tests.unit.TestCase' is not defined snapcraft/tests/unit/sources/test_subversion.py:28: error: Name 'unit.sources.SourceTestCase' is not defined snapcraft/tests/unit/sources/test_mercurial.py:31: error: Name 'unit.sources.SourceTestCase' is not defined snapcraft/tests/unit/sources/test_git.py:32: error: Name 'unit.sources.SourceTestCase' is not defined snapcraft/tests/unit/sources/test_bazaar.py:29: error: Name 'unit.sources.SourceTestCase' is not defined __init__.py should be used for imports only (common convention) and we should research getting rid of it all together by looking at https://www.python.org/dev/peps/pep-0420/ Answer in one of our code reviews: """ There are a bunch of issues in mypy related to using __init__.py, one of them is that for this to work you would need to import snapcraft.tests.unit.__init__ or something like that since it sort of works at the module level and not really at a package level. This is somewhat not urgent as it is discouraged to implement things in __init__.py in the python world. """

Evaluation history

No evaluation history available.